Skip to content

Fix flaky topic reader reconnect test - #924

Open
duckduckduck1 wants to merge 2 commits into
ydb-platform:mainfrom
duckduckduck1:fix/flaky-topic-reader-reconnect-test
Open

duckduckduck1 wants to merge 2 commits into
ydb-platform:mainfrom
duckduckduck1:fix/flaky-topic-reader-reconnect-test

Conversation

@duckduckduck1

Copy link
Copy Markdown

Fixes #850

Summary

  • Set the slow retry backoff to zero in this test to avoid timing-dependent delays.
  • Synchronize the mocked stream callbacks.
  • Close the reconnector in a finally block to clean up after the test.

Testing

  • tox -e py -- ydb/_topic_reader/topic_reader_asyncio_test.py::TestReaderReconnector::test_reconnect_on_repeatable_error — passed on Python 3.14.

@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.68%. Comparing base (33b601a) to head (93ba53f).
⚠️ Report is 21 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #924      +/-   ##
==========================================
+ Coverage   82.66%   82.68%   +0.02%     
==========================================
  Files          99       99              
  Lines       12951    12950       -1     
  Branches     1268     1440     +172     
==========================================
+ Hits        10706    10708       +2     
+ Misses       1794     1790       -4     
- Partials      451      452       +1     
Flag Coverage Δ
integration 80.37% <ø> (-0.08%) ⬇️
unit 49.26% <ø> (+0.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 12 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A moderate test-cleanup issue remains because a timed-out waiter task is neither cancelled nor awaited, allowing pending work or unhandled errors during event-loop teardown.

1 open issue
What changed in this PR

This pull request stabilizes the flaky asynchronous topic reader reconnect test by removing retry timing variability, synchronizing mocked callbacks, and cleaning up the reconnector.

Changes:

  • Sets the slow retry backoff duration to zero.
  • Synchronizes error and message callbacks with an asyncio.Event.
  • Closes the ReaderReconnector in a finally block.

Outstanding review comments:

  • Explicitly cancel and await the wait_message() task when polling times out.
  • Preserve the existing idempotent=True and retry_cancelled=True retry settings while overriding only the backoff duration.
File Summary
ydb/​_topic_reader/​topic_reader_asyncio_test.py Updates reconnect-test synchronization, retry settings, and cleanup handling; follow-up changes are needed for waiter-task cleanup and preserving existing retry flags.

Review effort: Lite

Refactor wait_message handling to use asyncio task cancellation.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky unit test: TestReaderReconnector.test_reconnect_on_repeatable_error (timeout on 3.12)

3 participants